<?php
/**
 * Created by Demo.
 * User: Demo
 * Date: 2015/9/14
 * Time: 13:08
 */

use App\Post;

use Illuminate\Database\Seeder;
use Carbon\Carbon;

class PostsTableSeeder extends Seeder {

    public function run() {
        $faker = Faker\Factory::create('zh_CN');

        Post::truncate();

        foreach(range(1,30) as $index) {
            Post::create([
                'post_author' => $faker->numberBetween($min = 1, $max = 9),
                'post_title' => $faker->sentence,
                'post_cover' => $faker->imageUrl($width = 640, $height = 480),
                'post_intro' => $faker->paragraph(8),
                'post_content' => $faker->text(2000),
                'post_status' => $faker->randomElement(['public', 'protected', 'private']),
                'menu_order' => 0,
                'comment_status' => $faker->randomElement(['public', 'private']),
                'comment_count' => $faker->numberBetween(0, 100),
                'published_at' => Carbon::now()
            ]);
        }
    }
}